package hzn;

import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;

import java.security.MessageDigest;
import java.util.Arrays;

public class Test {
    public static void main(String[] args)throws Exception {
        String pass="hello";
        MessageDigest md=MessageDigest.getInstance("MD5");
        byte[]arr=md.digest(pass.getBytes());
        System.out.println(new String(arr));
        BASE64Encoder ec=new BASE64Encoder();
        BASE64Decoder ed=new BASE64Decoder();
        System.out.println("密文编码后:"+ec.encode(arr));
        byte[]arr2=ed.decodeBuffer(ec.encode(arr));
        System.out.println(Arrays.equals(arr,arr2));
    }

}
